#!/usr/bin/python

import os, sys
from optparse import OptionParser
from stockie.cli.widgets import Table
from stockie.cli import common

common.setupEnv(globals())

usage = "Generate detailed profile report"
labels  = dict (name = "Name", sector = "Sector", symbol = "Symbol", quantity = "Quantity", current_price = "Current Price",
suggestion = "Suggestion")

parser = OptionParser(usage=usage)
(options, args) = parser.parse_args()

import pycallgraph
filter_func = pycallgraph.GlobbingFilter(
    include=["*cli*", "*stock*", "*interface*"],
    exclude=None,
    max_depth=4,
    )

pycallgraph.start_trace(filter_func=filter_func)

details_list = interface.listStocksDetails()

names = ['name', 'symbol', 'sector', 'quantity', 'current_price', 'suggestion', 'ur_profit', 'r_profit']
labels = ['Name', 'Symbol', 'Sector', 'Quantity', 'Current Price', 'Suggestion', 'Profit(Unrealized)', 'Profit(Realized)']
t = Table(names, labels)
t.addRows(details_list)
t.render()

#pycallgraph.make_dot_graph('test.png', "png", "twopi")
